package kr.inani.openapi.naver.book;

import org.w3c.dom.Element;
import org.w3c.dom.Node;

import kr.inani.openapi.Book;

public class NaverBook extends Book
{
	private static final long	serialVersionUID	= -7182236424822524716L;

	public NaverBook(Node bookNode)
	{
		super(elementSearch(bookNode, "title"), elementSearch(bookNode, "link"), elementSearch(bookNode, "image"), elementSearch(bookNode, "author"), elementSearch(bookNode, "price"), elementSearch(bookNode, "discount"), elementSearch(bookNode, "publisher"), elementSearch(bookNode, "pubdate"), elementSearch(bookNode, "isbn"), elementSearch(bookNode, "description"));
	}

	// ///////// private ////////////////
	private static String elementSearch(Node bookNode, String str)
	{
		Node tmpNode = ((Element) bookNode).getElementsByTagName(str).item(0).getFirstChild();
		if (tmpNode != null) {
			return tmpNode.getNodeValue();
		}
		return "";
	}

}
